<?php
/**
 * This file is part of Task Agile.
 * Task Agile is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License.
 * Task Agile is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Task Agile.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @category   TaskAgile
 * @package    Controller
 * @copyright  Copyright (c) 20010-2010 Estrada Virtual (http://estradavirtual.com.br)
 * @license    http://www.gnu.org/licenses/gpl.txt GPLv3
 * @version    $Id$
*/

?>
<div id="js-info">JavaScript has to be enabled for this demonstration.</div>
<div class="painel">
	<div class="item-painel">
		<a href="task/task/form" class="insert">
			<div class="nova-tarefa"></div>
			<span>Adicionar Tarefa</span>
		</a>
	</div>
	<div class="item-painel">
		<a href="task/project/list" class="insert">
			<div class="projetos"></div>
			<span>Projetos</span>
		</a>
	</div>
	<div class="item-painel">
		<a href="enterprise/enterprise/list" class="insert">
			<div class="empresas"></div>
			<span>Empresas</span>
		</a>
	</div>
	<div class="item-painel">
		<a href="enterprise/user/list" class="insert">
			<div class="usuarios"></div>
			<span>Usu&aacute;rios</span>
		</a>
	</div>
	<div class="item-painel">
		<a href="task/report/index" class="insert">
			<div class="relatorios"></div>
			<span>Relat&oacute;rios</span>
		</a>
	</div>
</div>
<div class="jquery_tabs example1" style="width: 600px; float: right;">
    <h3>Minhas Tarefas (<?php echo count($this->myTasks); ?>)</h3>
    <div class="tab-content">
    <?php if (count($this->myTasks)) : ?>
        <table border="1px" width="100%">
            <tr>
                <th>Ação</th>
                <th>Projeto</th>
                <th>Prioridade</th>
                <th>Tarefa</th>
            </tr>
<?php
$idUser = Zend_Auth::getInstance()->getIdentity()->id;
$tasks = $this->myTasks;
foreach ($tasks as $rowTask) :
    $aClass = array();
    if (Task::PRIORITY_HIGH == $rowTask->priority) {
        $aClass[] = 'priorityHigh';
    }
    if (Task::READ != $rowTask->read) {
        $aClass[] = 'taskNotRead';
    }

    if ($aClass) {
        $class = ' class="' . implode(' ', $aClass) . '"';
    } else {
        $class = '';
    }
?>
            <tr<?php echo $class; ?>>
                <td nowrap="nowrap">
                    <a href="task/task/see/id/<?php echo $rowTask->id; ?>"><img alt="Visualizar" title="Visualizar"  src="theme/default/img/famfamfam/eye.png" border="0"></a>
                    &nbsp;
                    <a href="task/task/close/id/<?php echo $rowTask->id; ?>"><img alt="Concluir" title="Concluir" src="theme/default/img/famfamfam/accept.png" border="0"></a>
                    <?php if ($idUser == $rowTask->fk_user_create) : ?>
                    &nbsp;
                    <a href="task/task/form/id/<?php echo $rowTask->id; ?>"><img alt="Editar" title="Editar" src="theme/default/img/famfamfam/table_edit.png" border="0"></a>
                    <?php endif; ?>
                 </td>
                <td><?php echo $this->projects[$rowTask->fk_project]; ?></td>
                <td><?php echo $this->prioritys[$rowTask->priority]; ?></td>
                <td><?php echo $rowTask->name; ?></td>
            </tr>
<?php endforeach ?>
        </table>
        <?php else : ?>
            <h4>Você não possui tarefas.</h4>
        <?php endif; ?>
    </div>

<h3>Tarefas Congeladas (<?php echo count($this->myTasksInactive); ?>)</h3>
    <div class="tab-content">
        Tarefas congeladas são tarefas que não serão feitas agora e foram congeladas para um momento futuro.
    <?php if (count($this->myTasksInactive)) : ?>
        <table border="2px" width="100%">
            <tr>
                <th>Ação</th>
                <th>Projeto</th>
                <th>Prioridade</th>
                <th>Tarefa</th>
            </tr>
<?php
$tasks = $this->myTasksInactive;
foreach ($tasks as $rowTask) : ?>
            <tr>
                <td>
                    <a href="task/task/see/id/<?php echo $rowTask->id; ?>"><img alt="Visualizar" title="Visualizar" src="theme/default/img/famfamfam/eye.png" border="0"></a>
                    &nbsp;
                    <a href="task/task/open/id/<?php echo $rowTask->id; ?>"><img alt="Reabrir" title="Reabrir" src="theme/default/img/famfamfam/wrench_orange.png" border="0"></a>
                 </td>
                <td><?php echo $this->projects[$rowTask->fk_project]; ?></td>
                <td><?php echo $this->prioritys[$rowTask->priority]; ?></td>
                <td><?php echo $rowTask->name; ?></td>
            </tr>
<?php endforeach ?>
        </table>
        <?php else :?>
        <h4>Você não possui tarefas congeladas</h4>
        <?php endif;?>
    </div>


    <h3>Tarefas Concluidas (<?php echo count($this->myTasksFinished); ?>)</h3>
    <div class="tab-content">
    <?php if (count($this->myTasksFinished)) : ?>
        <table border="2px" width="100%">
            <tr>
                <th>Ação</th>
                <th>Projeto</th>
                <th>Prioridade</th>
                <th>Tarefa</th>
            </tr>
<?php
$tasks = $this->myTasksFinished;
foreach ($tasks as $rowTask) : ?>
            <tr>
                <td>
                    <a href="task/task/see/id/<?php echo $rowTask->id; ?>"><img alt="Visualizar" title="Visualizar" src="theme/default/img/famfamfam/eye.png" border="0"></a>
                    &nbsp;
                    <a href="task/task/open/id/<?php echo $rowTask->id; ?>"><img alt="Reabrir" title="Reabrir" src="theme/default/img/famfamfam/wrench_orange.png" border="0"></a>
                 </td>
                <td><?php echo $this->projects[$rowTask->fk_project]; ?></td>
                <td><?php echo $this->prioritys[$rowTask->priority]; ?></td>
                <td><?php echo $rowTask->name; ?></td>
            </tr>
<?php endforeach ?>
        </table>
        <?php else :?>
        <h4>Você não possui tarefas finalizadas</h4>
        <?php endif;?>
    </div>

    <h3>Tarefas de outros (<?php echo count($this->notMyTasks); ?>)</h3>
    <div class="tab-content">
<?php if (count($this->notMyTasks)) : ?>
        <table border="2px" width="100%">
            <tr>
                <th>Ação</th>
                <th>Responsável</th>
                <th>Projeto</th>
                <th>Prioridade</th>
                <th>Tarefa</th>
            </tr>
<?php
$tasks = $this->notMyTasks;
foreach ($tasks as $rowTask) :
    $class = '';
    if (Task::PRIORITY_HIGH == $rowTask->priority ) {
        $class = ' class="priorityHigh"';
    }
?>
            <tr<?php echo $class; ?>>
                <td>
                    <a href="task/task/see/id/<?php echo $rowTask->id; ?>"><img alt="Visualizar" title="Visualizar"  src="theme/default/img/famfamfam/eye.png" border="0"></a>
                </td>
                <td><?php echo $this->users[$rowTask->fk_user]; ?></td>
                <td><?php echo $this->projects[$rowTask->fk_project]; ?></td>
                <td><?php echo $this->prioritys[$rowTask->priority]; ?></td>
                <td><?php echo $rowTask->name; ?></td>
            </tr>
<?php endforeach ?>
        </table>
        <?php else :?>
        <h4>Não existe tarefas para outros usuários</h4>
        <?php endif;?>
    </div>
</div>
